package com.hehua.FacadePattern;

/**
 * 加密外观类,充当外观类
 */
public class EncryptFacade {
    /**
     * 维持对子系统对象的引用
     */
    private FileWriter fileWriter;

    private FileReader fileReader;

    private CipherMachine cipherMachine;

    public EncryptFacade(){
        fileWriter = new FileWriter();
        fileReader = new FileReader();
        cipherMachine = new CipherMachine();
    }
    //调用子系统对象的业务方法
    public void fileEncrypt(String fileNameSrc,String fileNameDes){
        String read = fileReader.read(fileNameSrc);
        String encrypt = cipherMachine.encrypt(read);
        fileWriter.write(encrypt,fileNameDes);
    }
}
